//
//  NSString+Validation.h
//  yuke
//
//  Created by Dejun Liu on 15/1/12.
//  Copyright (c) 2015年 juwan. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSString (Validation)

// Returns a string with the email address corrected for common domain typos.
// Supports misspelled variations for Gmail, Googlemail, Hotmail, Yahoo and Ymail.
// Replaces a ".con" suffix with ".com" for any domain.
// More domains can be easily added using a simple dictionary format.
//
// Some examples of bad email addresses that will be corrected:
// robert@gmial.com -> robert@gmail.com (1 error)
// robert@gmial.con -> robert@gmail.com (2 errors)
// robert@hotmail.con -> robert@hotmail.com (1 error)
// robert@hoitmail.com -> robert@hotmail.com (1 error)
// robert@hoitmail.con -> robert@hotmail.com (2 errors)
// robert@aol.con -> robert@aol.com (1 error)
// robert.con@aol.con -> robert.con@aol.com (1 error, but special case with multiple .con's)
//
// Besides correcting the typos, it also lowercases the email address.
// If the email address is invalid, returns the original value.
// Use - [isValidEmailAddress] to validate the email address first if necessary.
- (NSString *)stringByCorrectingEmailTypos;
// Validate the email syntax (not domains) using a RegEx pattern.
- (BOOL)isValidEmailAddress;

@end
